<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <META HTTP-EQUIV="pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
    <META HTTP-EQUIV="expires" CONTENT="0">
    <link rel="stylesheet" href="../../../layui/css/layui.css?v=1" media="all">
    <script src="../../../js/jquery/3.5.1/jquery.js?v=1"></script>
    <script src="../../../layui/layui.js?v=1" charset="utf-8"></script>
    <script src="../../../js/config.js?v=1"></script>
    <script src="../../../js/public.js?v=1"></script>
    <script src="../../../js/function.js?v=1"></script>
    <link rel="stylesheet" href="../../../css/public.css?v=1">
    <link rel="stylesheet" href="../../../css/patient/patient_info.css?v=1">
    <style>
        .add-container {
            min-height: 700px;
        }

        .picBox {
            position: relative;
        }

        .btnUpload {
            width: 104px;
            height: 104px;
            position: relative;
            float: left;
            background: url(../../../img/shangchuanzhaopian.png) no-repeat;
            overflow: hidden;
            text-decoration: none;
            text-indent: 0;
        }

        .btnUpload input {
            position: absolute;
            width: 100px;
            height: 100px;
            right: 0;
            top: 0;
            opacity: 0;
        }

        .picList {
            float: left;
        }

        .picItem {
            width: 104px;
            height: 104px;
            text-align: center;
            display: inline-block;
            margin-right: 10px;
            border: 1px solid #ccc;
            border-radius: 5px;
            float: left;
            position: relative;
        }

        .picItem .pic {
            max-width: 100%;
            max-height: 100%;
            width: 104px;
            height: 104px;
            cursor: pointer;
        }

        .picItem .close1 {
            position: absolute;
            right: 2px;
            top: 2px;
            z-index: 1000;
            background: url("../../../img/cuowu.png") no-repeat;
            cursor: pointer;
            width: 20px;
            height: 20px;
        }

        .go-yz-tip {
            color: #b30f0f;
        }
        #jobListPanel{
            display: flex;
            flex-flow: wrap;
            width: 800px;
        }
        #jobListPanel .layui-form-radio{
            min-width: 300px;

        }
    </style>
</head>

<body>
<div class="container">
    <div class="table-title">
        <ul class="table-title-tab">
            <li class="tab-curr">
                <p>基本信息</p>
                <p class="complete_basic">0%</p>
            </li>
            <li>
                <a href="../qss/qss1.html">
                    <p>病历采集</p>
                    <p class="complete_qss">0%</p>
                </a>
            </li>
            <li>
                <a href="../qss/qss7.html">
                    <p>检查信息</p>
                    <p style="display: none;">0%</p>
                </a>
            </li>
            <div class="clear"></div>
        </ul>
    </div>
    <div class="add-container">
        <div class="baseinfo-box">
            <form class="layui-form">

                <div class="baseinfo-box-title">
                    <p>基本信息</p>
                </div>
                <div class="baseinfo-item">
                    <div class="layui-form-item layui-inline">
                        <div class="layui-form-label">患者姓名</div>
                        <div class="layui-input-inline">
                            <input type="text" name="name" class="layui-input" lay-verify="name" lay-verType="tips" placeholder="请输入患者姓名">
                        </div>
                    </div>
                    <div class="layui-form-item layui-inline">
                        <div class="layui-form-label" style="letter-spacing: 25px;text-align: center;">性别</div>
                        <div class="layui-input-inline" lay-verify="gender" lay-verType="tips">
                            <button class="sex-btn sex-checkbox" type="button" data-val="0">男</button>
                            <button class="sex-btn sex-checkbox" type="button" data-val="1">女</button>
                            <input type="hidden" name="sex">
                        </div>
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="baseinfo-item" style="display: none;">
                    <div class="layui-form-item layui-inline">
                        <div class="layui-form-label">出院病史 病案首页</div>
                    </div>
                    <div class="layui-form-item layui-inline picBox">
                        <div class="picList">

                        </div>
                        <div class="btnUpload" id="btnUpload">
                            <input type="file" name="upload" lay-verify="upload" id="fileUpload" accept="image/*" />
                        </div>
                        <input class="picID" type="hidden" name="pic_id">
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="baseinfo-item">
                    <div class="layui-form-item layui-inline">
                        <div class="layui-form-label">出生日期</div>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="bday" id="bday" lay-verify="birthday" lay-verType="tips" placeholder="请选择出生日期" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-form-item layui-inline">
                        <div class="layui-form-label" style="letter-spacing: 25px;text-align: center;">民族</div>
                        <div class="layui-input-inline">
                            <select name="ethnicity" lay-verify="nation" lay-verType="tips">
                                <option value="">请选择</option>
                                <option value="汉族">汉族</option>
                                <option value="蒙古族">蒙古族</option>
                                <option value="回族">回族</option>
                                <option value="藏族">藏族</option>
                                <option value="维吾尔族">维吾尔族</option>
                                <option value="苗族">苗族</option>
                                <option value="彝族">彝族</option>
                                <option value="壮族">壮族</option>
                                <option value="布依族">布依族</option>
                                <option value="朝鲜族">朝鲜族</option>
                                <option value="满族">满族</option>
                                <option value="侗族">侗族</option>
                                <option value="瑶族">瑶族</option>
                                <option value="白族">白族</option>
                                <option value="土家族">土家族</option>
                                <option value="哈尼族">哈尼族</option>
                                <option value="哈萨克族">哈萨克族</option>
                                <option value="傣族">傣族</option>
                                <option value="黎族">黎族</option>
                                <option value="僳僳族">僳僳族</option>
                                <option value="佤族">佤族</option>
                                <option value="畲族">畲族</option>
                                <option value="高山族">高山族</option>
                                <option value="拉祜族">拉祜族</option>
                                <option value="水族">水族</option>
                                <option value="东乡族">东乡族</option>
                                <option value="纳西族">纳西族</option>
                                <option value="景颇族">景颇族</option>
                                <option value="柯尔克孜族">柯尔克孜族</option>
                                <option value="土族">土族</option>
                                <option value="达斡尔族">达斡尔族</option>
                                <option value="仫佬族">仫佬族</option>
                                <option value="羌族">羌族</option>
                                <option value="布朗族">布朗族</option>
                                <option value="撒拉族">撒拉族</option>
                                <option value="毛南族">毛南族</option>
                                <option value="仡佬族">仡佬族</option>
                                <option value="锡伯族">锡伯族</option>
                                <option value="阿昌族">阿昌族</option>
                                <option value="普米族">普米族</option>
                                <option value="塔吉克族">塔吉克族</option>
                                <option value="怒族">怒族</option>
                                <option value="乌孜别克族">乌孜别克族</option>
                                <option value="俄罗斯族">俄罗斯族</option>
                                <option value=鄂温克族"">鄂温克族</option>
                                <option value="德昂族">德昂族</option>
                                <option value="保安族">保安族</option>
                                <option value="裕固族">裕固族</option>
                                <option value="京族">京族</option>
                                <option value="塔塔尔族">塔塔尔族</option>
                                <option value="独龙族">独龙族</option>
                                <option value="鄂伦春族">鄂伦春族</option>
                                <option value="赫哲族">赫哲族</option>
                                <option value="门巴族">门巴族</option>
                                <option value="珞巴族">珞巴族</option>
                                <option value="基诺族">基诺族</option>
                            </select>
                        </div>
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="baseinfo-item">
                    <div class="layui-form-item layui-inline">
                        <div class="layui-form-label">身份证号</div>
                        <div class="layui-input-inline">
                            <input type="text" name="sfzid" class="layui-input" lay-verify="id_number" lay-verType="tips" placeholder="请输入身份证号">
                        </div>
                    </div>
                    <div class="layui-form-item layui-inline">
                        <div class="layui-form-label" style="letter-spacing: 25px;text-align: center;">籍贯</div>
                        <div class="layui-input-inline">
                            <!--<input type="text" class="layui-input" name="birthplace" placeholder="请输入籍贯">-->
                            <select class="layui-select birthplace" name="ancestral_home" lay-verify="native" lay-verType="tips">
                                <option value="">请选择</option>
                                <option>北京</option>
                                <option>上海</option>
                            </select>
                        </div>
                    </div>
                    <div class="clear"></div>
                </div>

                <div class="baseinfo-item">
                    <div class="layui-form-item layui-inline item-height">
                        <div class="layui-form-label">身高</div>
                        <div class="layui-input-inline">
                            <input type="text" name="height" lay-verify="id_height" lay-verType="tips" class="layui-input" placeholder="请输入身高">

                        </div><span style="float: right;">cm</span>

                    </div>
                    <div class="layui-form-item layui-inline">
                        <div class="layui-form-label" style="letter-spacing: 25px;text-align: left;padding-left: 13px;width:96px">体重</div>
                        <div class="layui-input-inline " style="padding-left: -14px;">
                            <input type="text" name="weight" lay-verify="id_weight" lay-verType="tips" class="layui-input" placeholder="请输入体重">
                        </div><span style="float: right;">kg</span>
                    </div>
                </div>
                <div class="baseinfo-item">
                    <div class="layui-form-item layui-inline item-height">
                        <div class="layui-form-label">体质指数BMI</div>
                        <div class="layui-input-inline">
                            <input type="text" name="physian" lay-verify="id_physian" lay-verType="tips" class="layui-input" placeholder="请输入体质指数">

                        </div><span style="float: right;">kg/㎡</span>

                    </div>
                    <div class="layui-form-item layui-inline">
                        <div class="layui-form-label" style="letter-spacing: 25px;text-align: left;width:94px">腰围</div>
                        <div class="layui-input-inline " style="padding-left: -14px;">
                            <input type="text" name="yaowei" lay-verify="id_yaowei" lay-verType="tips" class="layui-input" placeholder="请输入腰围">
                        </div><span style="float: right;">cm</span>
                    </div>
                </div>
                <div class="baseinfo-item">
                    <div class="layui-form-item layui-inline item-height">
                        <div class="layui-form-label">臀围</div>
                        <div class="layui-input-inline">
                            <input type="text" name="tun" lay-verify="id_tun" lay-verType="tips" class="layui-input" placeholder="请输入臀围">

                        </div><span style="float: right;">cm</span>

                    </div>

                </div>

                <div class="baseinfo-item">
                    <div class="layui-form-item layui-inline">
                        <div class="layui-form-label">联系手机</div>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="cell" placeholder="请输入手机号" disabled>
                        </div>
                    </div>
                    <!-- <div class="layui-form-item layui-inline">
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" placeholder="请输入验证码">
                        </div>
                    </div> -->
                    <div class="layui-form-item layui-inline edit_mobile_panel">
                        <div class="layui-input-inline">
                            <button class="get-code" id="edit_mobile" type="button">点击修改</button>
                        </div>
                    </div>
                    <!-- 去验证 -->
                    <div class="layui-form-item layui-inline go-yz-tip-panel">
                        <div class="layui-input-inline">
                            <button class="get-code" id="checkMobile" type="button">去验证</button>
                            <span class="go-yz-tip">*手机号未验证，点击去验证</span>
                        </div>
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="qss-form-item layui-form-item">
                    <div class="layui-row"><div class="layui-col-xs2">* 现在或退休前职业 </div><div id="showJobDesc" class="layui-col-xs6"  style="color:blue;font-weight:bold;cursor:pointer;">【职业填写说明】</div></div>
                    <div class="qss-form-item-radio layui-form-item">
                        <div id="jobListPanel" class="layui-col-xs6">
                        </div>
                    </div>
                </div>
                <!--v1.1-->
                <!--                <div class="baseinfo-item">-->
                <!--                    <div class="layui-form-item layui-inline">-->
                <!--                        <div class="layui-form-label">住院病案首页</div>-->
                <!--                    </div>-->
                <!--                    <div class="layui-form-item layui-inline picBox">-->
                <!--                        <div class="picList">-->

                <!--                        </div>-->
                <!--                        <div class="btnUpload" id="btnUpload">-->
                <!--                            <input type="file" id="fileUpload" accept="image/*"/>-->
                <!--                        </div>-->
                <!--                        <input class="picID" type="hidden" name="pic_id">-->
                <!--                    </div>-->
                <!--                    <div class="clear"></div>-->
                <!--                </div>-->
                <div class="baseinfo-item">
                    <div class="layui-form-item layui-inline">
                        <div class="layui-form-label" style="width:200px;">家庭成员有无垂体疾病？</div>
                        <div class="layui-input-inline">
                            <button class="family_like_has" type="button" data-val="1">有</button>
                            <button class="family_like_has" type="button" data-val="0">无</button>
                            <input type="hidden" name="family_like_has">
                            </button>
                        </div>
                        <div class="layui-inline family_like_has_type_name" style="display: none">
                            <!--v1.1 亲属类型 诊断名称-->
                            <div class="layui-form-label" style="width:70px;margin-left: 20px">亲属类型</div>
                            <div class="layui-input-inline" style="width: 120px;">
                                <select class="layui-select" name="family_like_has_chuiti_relationship" id="family_like_has_chuiti_relationship">
                                    <option value="">请选择</option>
                                    <option value="父亲">父亲</option>
                                    <option value="母亲">母亲</option>
                                    <option value="儿子">儿子</option>
                                    <option value="女儿">女儿</option>
                                    <option value="兄弟">兄弟</option>
                                    <option value="姐妹">姐妹</option>
                                    <option value="祖父">祖父</option>
                                    <option value="祖母">祖母</option>
                                    <option value="外祖父">外祖父</option>
                                    <option value="外祖母">外祖母</option>
                                </select>
                            </div>
                            <div class="layui-form-label" style="width:70px;margin-left: 20px">诊断名称</div>
                            <div class="layui-input-inline" style="width: 120px;">
                                <input type="text" class="layui-input" name="family_like_has_type_name" lay-verify="disease" lay-verType="tips">
                            </div>
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>
                <!--v1.1-->
                <div class="baseinfo-item zhongliu-item" style="display: none;">
                    <div class="layui-form-item layui-inline">
                        <div class="layui-form-label" style="width:200px;">家庭成员有无内分泌肿瘤疾病？</div>
                        <div class="layui-input-inline" style="width:auto;">
                            <button class="family_like_has_zhongliu" type="button" data-val="1">有</button>
                            <button class="family_like_has_zhongliu" type="button" data-val="0">无</button>
                            <input type="hidden" name="family_like_has_zhongliu">
                        </div>
                        <div class="layui-inline family_like_has_zhongliu_name" style="display: none">
                            <!--v1.1 亲属类型 诊断名称-->
                            <div class="layui-form-label" style="width:70px;margin-left: 20px">亲属类型</div>
                            <div class="layui-input-inline" style="width: 120px;">
                                <select class="layui-select" name="family_like_has_zhongliu_relationship" id="family_like_has_zhongliu_relationship">
                                    <option value="">请选择</option>
                                    <option value="父亲">父亲</option>
                                    <option value="母亲">母亲</option>
                                    <option value="儿子">儿子</option>
                                    <option value="女儿">女儿</option>
                                    <option value="兄弟">兄弟</option>
                                    <option value="姐妹">姐妹</option>
                                    <option value="祖父">祖父</option>
                                    <option value="祖母">祖母</option>
                                    <option value="外祖父">外祖父</option>
                                    <option value="外祖母">外祖母</option>
                                </select>
                            </div>
                            <div class="layui-form-label" style="width:70px;margin-left: 20px">诊断名称</div>
                            <div class="layui-input-inline" style="width: 120px;">
                                <input type="text" class="layui-input" name="family_like_has_zhongliu_name" lay-verify="disease" lay-verType="tips">
                            </div>
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>
                <div class="baseinfo-box-title">
                    <p>垂体疾病类型</p>
                </div>
                <div class="baseinfo-box-title" style="font-size:14px;color:#333333;">
                    <p>关于垂体疾病描述符合以下哪条？</p>
                </div>
                <div class="baseinfo-item">
                    <div class="layui-form-item">
                        <div class="layui-form-label">a.是否诊断为垂体瘤</div>
                        <div class="layui-input-inline" style="float:right;margin-right:200px;">
                            <button class="is_chuiti" type="button" data-val="1">是</button>
                            <button class="is_chuiti" type="button" data-val="0">否</button>
                            <input type="hidden" name="has_chuiti">
                        </div>
                    </div>
                </div>
                <div class="has-pituitary" style="display:none;">
                    <div class="baseinfo-item">
                        <div class="layui-form-item">
                            <div class="layui-form-label">b.垂体瘤功能状态：</div>
                        </div>
                    </div>
                    <div class="baseinfo-item">
                        <div class="layui-form-item">
                            <input type="checkbox" name="types" lay-skin="primary" title="无功能瘤" value="1">
                            <input type="checkbox" name="types" lay-skin="primary" title="GH瘤" value="2">
                            <input type="checkbox" name="types" lay-skin="primary" title="PRL瘤" value="3">
                            <input type="checkbox" name="types" lay-skin="primary" title="ACTH瘤" value="4">
                            <input type="checkbox" name="types" lay-skin="primary" title="TSH瘤" value="5">
                            <input type="checkbox" name="types" lay-skin="primary" title="GnH瘤（FSH/LH瘤）" value="6">
                            <input type="checkbox" name="types" lay-skin="primary" title="未评估" value="7">

                        </div>
                    </div>
                </div>
                <div class="no-has-pituitary">
                    <div class="baseinfo-item">
                        <div class="layui-form-item">
                            <div class="layui-form-label">c.其他垂体疾病：</div>
                        </div>
                    </div>
                    <div class="baseinfo-item">
                        <div class="layui-form-item">
                            <input type="checkbox" name="types" value="11" lay-skin="primary" title="Rathke囊肿">
                            <input type="checkbox" name="types" value="12" lay-skin="primary" title="颅咽管瘤">
                            <input type="checkbox" name="types" value="13" lay-skin="primary" title="垂体柄阻断综合征">
                            <input type="checkbox" name="types" value="14" lay-skin="primary" title="淋巴细胞性垂体炎">
                            <input type="checkbox" name="types" value="15" lay-skin="primary" title="组织增生症">
                            <input type="checkbox" name="types" value="16" lay-skin="primary" title="生殖细胞瘤">
                            <input type="checkbox" name="types" value="17" lay-skin="primary" title="垂体柄增粗（病因未明）">
                        </div>
                    </div>
                </div>
                <div class="baseinfo-item-btn">
                    <button type="button" lay-submit="" lay-filter="submit-btn">提交</button>
                </div>
            </form>
        </div>
    </div>
</div>
<div class="fixed-container-1  fixed-container change-center-container">
    <div class="fixed-main">
        <div class="fixed-title">
            <p>修改手机</p>
            <i class="layui-icon layui-icon-close fixed-main-close"></i>
        </div>
        <div class="fixed-form">
            <form class="layui-form">
                <div class="fixed-form-item">
                    <div class="layui-form-label">原手机号</div>
                    <div class="layui-input-inline">
                        <div class="layui-form-label old-cell">15203730120</div>
                    </div>
                </div>
                <div class="fixed-form-item">
                    <div class="layui-form-label">手机号</div>
                    <div class="layui-input-inline">
                        <input type="text" name="new_mobiles" class="layui-input" placeholder="请输入新手机号">
                    </div>
                </div>
                <div class="fixed-form-item">
                    <div class="layui-form-label">验证码</div>
                    <div class="layui-input-inline">
                        <input type="text" name="new_mobile_code" placeholder="" class="layui-input" id="send_test">
                        <button type="button" class="layui-inline send-code1" id="sendSms">点击获取</button>
                    </div>
                </div>
                <div class="fixed-form-item-confirm">
                    <button type="button" class="cancel-btn">取消</button>
                    <button style="background:#4777E7;color:white;" class="changeCellBtn" type="button">提交</button>
                </div>
            </form>
        </div>
    </div>
</div>
<!-- 验证手机号 -->
<div class="check_mobile_popup fixed-container change-center-container">
    <div class="fixed-main">
        <div class="fixed-title">
            <p>验证手机</p>
            <i class="layui-icon layui-icon-close fixed-main-close"></i>
        </div>
        <div class="fixed-form">
            <form class="layui-form">
                <div class="fixed-form-item">
                    <div class="layui-form-label"><!-- 原手机号 --></div>
                    <div class="layui-input-inline">
                        <div class="layui-form-label old-cell" id="yuaniphone">15203730120</div>
                    </div>
                </div>
                <div  class="fixed-form-item">
                    <div class="layui-form-label"></div>
                    <!-- <div class="layui-input-inline">
                        <input type="text" name="new_mobiles" class="layui-input" placeholder="请输入新手机号">
                    </div> -->
                </div>
                <div class="fixed-form-item">
                    <div class="layui-form-label">验证码</div>
                    <div class="layui-input-inline">
                        <input type="text" name="new_mobile_code1" placeholder="" class="layui-input" id="send_test">
                        <button type="button" class="layui-inline send-code2" id="sendSms">获取验证码</button>
                    </div>
                </div>
                <div class="fixed-form-item-confirm">
                    <button type="button" class="cancel-btn">取消</button>
                    <button style="background:#4777E7;color:white;" class="check_mobile_popup_submit" type="button">验证</button>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
<script>

    layui.use('form', function() {
        var form = layui.form;
        form.render();
    });

    var maxtime = 60;
    var timer;
    //更换手机号获取验证码
    function CountSendSms() {
        if (maxtime >= 0) {
            --maxtime;
            $("#sendSms").html(maxtime + '秒后获取');
            $("#sendSms").attr('disabled', true);
        } else {
            $("#sendSms").html('获取验证码');
            $("#sendSms").attr('disabled', false);
            clearInterval(timer);
        }
    }

    //上传图片
    function addPicItem(src, id) {
        var randId = Math.floor(Math.random() * 1000);
        var str = '<div class="picItem" id="pic-' + randId + '" data-picid="' + id + '">\n' +
            '<img class="pic" src="' + src + '" />\n' +
            '<div class="close1"></div> </div>';
        $(".btnUpload").hide();
        $(".picList").append(str);
        $(".picID").attr("value", id);
    }

    //删除图片
    $(".picList").on('click', ".close1", function() {
        var picId = $(this).parents('.picItem').attr('data-picid');
        $(".btnUpload").show();
        console.log('picId=', picId);
        $(".picID").attr("value", "");
        // for(var i = 0; i<picIdList.length;i++){
        //     if(picIdList[i] == picId){
        //         picIdList.splice(i,1);
        //     }
        // }

        $(this).parents('.picItem').remove();
    });
    //职业弹出说明
    $('#showJobDesc').click(function(){
        layer.open({
            title:'职业填写说明',
            type:1,
            skin:'layui-layer-rim',
            area:['800px','600px'],
            content:`<div style="padding:10px 15px;line-height:24px;font-size:14px;"><div><b>农林鱼牧水利业生产人员：</b> 从事农业、林业、畜牧业、渔业及水利业生产、管理、产品初加工人员。</div>
                <div><b>生产、运输设备操作人员及有关人员：</b> 从事矿业勘察、开采产品生产制造、工程施工和运输设备操作的人员及有关人员。</div>
                <div><b>商业、服务业人员：</b> 从事商业、餐饮、旅游娱乐、运输、医疗辅助及社会和居民生活等服务工作的人员。</div>
                <div><b>国家机关、党群组织、企事业单位负责人：</b> 在中国共产党中央委员会和地方各级党组织，各级人民代表大会常务委员会，人民政协、人民法院、人民检察院、国家行政机关、各民主党派，工会、共青团、妇联等人民团体，群众自治组织和其他社团组织及其工作机构，企业、事业单位中担任领导职务并具有决策。管理权的人员。</div>
                <div><b>办事人员和有关人员：</b> 在国家机关、党群组织、企业、事业单位中从事行政业务、行政事务工作的人员和从事安全保卫、消防、邮电等业务的人员。</div>
                <div><b>专业技术人员：</b> 从事科学研究和专业技术工作的人员。包括科学研究人员、科技管理和辅助人员、飞机和船舶技术人员、医疗卫生人员、法律工作人员、经济管理专业人员、教师、教学辅助人员、文艺和体育工作人员。</div>
                <div><b>军人：</b> 指在军队、武警部队正在服役的军人。</div>
                <div><b>其他劳动者：</b> 不便分类的其他从业人员。</div>
                <div><b>在校学生：</b> 指正在就读的大、中学生。</div>
                <div><b>未就业：</b> 指无业在家以及毕业尚未找到工作的学生，不包括离退休人员。</div>
                <div><b>家务：</b> 主要从事家务活动，如洗衣、做饭等、如家庭主妇、下岗在家从事家务者属于未就业。</div></div>`
        })
    })
    //预览图片
    $('.picList').on('click', '.pic', function() {
        that = $(this);
        let img = new Image();
        img.src = $(this).attr('src');

        console.log(img.width + ';' + img.height);
        width = img.width;
        height = img.height;
        //if(width>600px;)
        layer.open({
            type: 1,
            title: false,
            closeBtn: 0,
            area: ['auto'],
            skin: 'layui-layer-nobg', //没有背景色
            shadeClose: true,
            content: '<div style="width:' + width + ';height:' + height + ';max-width:600px;max-height:500px;"><img src="' + that.attr('src') + '" width="100%" height="100%" /></div>'
        });
    });

    //调用后台上传图片
    $("#fileUpload").change(function() {
        console.log($("#fileUpload")[0].files[0]);
        var fileType = $("#fileUpload")[0].files[0].type;
        if (fileType != 'image/jpeg' && fileType != 'image/jpg' && fileType != 'image/png') {
            layer.msg('请选择图片文件');
            return false;
        }

        var fileSize = $("#fileUpload")[0].files[0].size;
        if (fileSize > 10485760) {
            layer.msg('上传的图片不能超过10M');
            return false;
        }

        addPicItem(URL.createObjectURL($(this)[0].files[0]), 0);
        //var files = $(this).prop('files');
        //console.log(files);
        let formData = new FormData;
        //formData.append('fileData',$("#fileUpload").prop('files')[0]);
        formData.append('filedata', $("#fileUpload")[0].files[0]);
        formData.append('user_id', getLocalStorage('patient_id'));
        formData.append('doc_id', getLocalStorage('doc_id'));
        formData.append('visit_level', 1);
        var token = getLocalStorage('token');
        var headers = {};
        if (token) {
            headers.Authorization = 'Bearer ' + token;
        }
        $.ajax({
            url: configUrl.host + '/api/v1/pituitary/upload',
            type: 'POST',
            data: formData,
            processData: false,
            cache: false,
            contentType: false,
            headers: headers,
            success: function(res) {
                console.log(res);
                if (res.status == 0) {
                    var randId = Math.floor(Math.random() * 1000);
                    $(".picID").attr("value", res.data.id);
                    //picIdList.push(res.data.id);
                    $("#pic-" + randId).attr('data-picid', res.data.id);
                    console.log('img-id:' + res.data.id);
                }
            },
            error: function() {
                alert('上传失败');
            }
        })
    });

    $(document).ready(function() {

        //v1.1注释
        // var height = $(window).height() - 2;
        // $('.add-container').height(height - 39);
        // //$('.container').height(height);
        getCompletion();
        //
        // window.onload=function(){
        //     var height = $(window).height() - 2;
        //     $('.add-container').height(height - 39);
        //     //$('.container').height(height);
        //     changeContainerHeight();
        // }
        // window.onresize=function(){
        //     //console.log('11')
        //     changeContainerHeight();
        // }
        // function changeContainerHeight(){
        //     var height = $(window).height() - 2;
        //     //$('.container').height(height);
        //     $('.add-container').height(height - 39);
        // };



        layui.use(['element', 'form', 'layer', 'laydate', 'laypage'], function() {
            var element = layui.element;
            var form = layui.form;
            var layer = layui.layer;
            var laydate = layui.laydate;
            var laypage = layui.laypage;

            //允许最大时间
            var now = new Date();
            var year = parseInt(now.getFullYear());
            var month = parseInt(now.getMonth() + 1);
            var day = now.getDate();
            var max_date = year + '-' + month + '-' + day;
            //出生日期
            laydate.render({
                elem: '#bday',
                'max': max_date,
            });

            var patient_id = getLocalStorage('patient_id');
            console.log(patient_id);
            var patient_info = '';

            ajax_get(configUrl.patientInfo, {
                user_id: patient_id
            }, (res) => {
                console.log(res);
                var jobList = res.data.occupationInfo
                console.log({jobList})
                $.each(jobList, function(index, item) {
                    var tag = item.option_value == res.data.job?' checked ':''


                    var info = '<input style="min-width:300px;" type="radio" title="'+item.option_name+'" name="option_value" class="cv-11701" value="'+item.option_value+'" '+ tag  +' lay-filter="radio117">'

                    $('#jobListPanel').append(info);
                });
                patient_info = res.data;
                // todo 需要后端确定是否“去验证”的字段 harvey
                if (patient_info.telstatus == 1) {
                    $('.go-yz-tip-panel').show()
                    $('.edit_mobile_panel').hide()
                } else {
                    $('.go-yz-tip-panel').hide()
                    $('.edit_mobile_panel').show()
                }

                if (res.status == 0) {
                    $('input[name=user_id]').val(patient_info.user_id);
                    $('input[name=name]').val(patient_info.name);
                    $('input[name=sex]').val(patient_info.sex);
                    $('input[name=bday]').val(patient_info.bday);
                    $('input[name=ethnicity]').val(patient_info.ethnicity);
                    $('input[name=sfzid]').val(patient_info.sfzid);
                    $('input[name=ancestral_home]').val(patient_info.ancestral_home);
                    $('input[name=cell]').val(patient_info.cell);
                    $('.old-cell').text(patient_info.cell);
                    $('input[name=has_chuiti]').val(patient_info.has_chuiti);


                    $('input[name=height]').val(patient_info.height);
                    $('input[name=weight]').val(patient_info.weight);
                    $('input[name=physian]').val(patient_info.physian);
                    $('input[name=yaowei]').val(patient_info.yaowei);
                    $('input[name=tun]').val(patient_info.tun);

                    $('input[name=family_like_has]').val(patient_info.family_like_has);
                    $('#family_like_has_chuiti_relationship').val(patient_info.family_like_has_chuiti_relationship);
                    $('input[name=family_like_has_type_name]').val(patient_info.family_like_has_type_name);
                    if (patient_info.family_like_has == 0) {
                        $('.baseinfo-item .family_like_has:nth-child(2)').addClass('family_like_has_checked');
                        $('.baseinfo-item .family_like_has_type_name').hide();
                        $('.zhongliu-item').hide();
                    } else if (patient_info.family_like_has == 1) {
                        $('.baseinfo-item .family_like_has:nth-child(1)').addClass('family_like_has_checked');
                        $('.baseinfo-item .family_like_has_type_name').show();
                        $('.zhongliu-item').show();
                    }
                    //v1.1
                    $('input[name=family_like_has_zhongliu]').val(patient_info.family_like_has_zhongliu);
                    $('input[name=family_like_has_zhongliu_name]').val(patient_info.family_like_has_zhongliu_name);
                    $('#family_like_has_zhongliu_relationship').val(patient_info.family_like_has_zhongliu_relationship);
                    if (patient_info.family_like_has_zhongliu == 0) {
                        $('.baseinfo-item .family_like_has_zhongliu:nth-child(2)').addClass('family_like_has_zhongliu_checked');
                        $('.baseinfo-item .family_like_has_zhongliu_name').hide();
                    } else if (patient_info.family_like_has_zhongliu == 1) {
                        $('.baseinfo-item .family_like_has_zhongliu:nth-child(1)').addClass('family_like_has_zhongliu_checked');
                        $('.baseinfo-item .family_like_has_zhongliu_name').show();
                    }
                    $('input[name=pic_id]').val(patient_info.pic_id);
                    if (patient_info.pic_id > 0) {
                        addPicItem(patient_info.file, patient_info.pic_id);
                    };

                    if (patient_info.sex == 0) {
                        $('.baseinfo-item .sex-checkbox:nth-child(1)').addClass('sex-btn-checked');
                        $('.baseinfo-item .sex-checkbox:nth-child(1)').siblings('button').removeClass('sex-btn-checked');
                    } else {
                        $('.baseinfo-item .sex-checkbox:nth-child(2)').addClass('sex-btn-checked');
                        $('.baseinfo-item .sex-checkbox:nth-child(2)').siblings('button').removeClass('sex-btn-checked');
                    };
                    if (patient_info.has_chuiti == 1) {
                        $('.has-pituitary').show();
                        $('.no-has-pituitary').hide();
                        $('.baseinfo-item .is_chuiti:nth-child(1)').addClass('is_chuiti_checked');
                        $('.baseinfo-item .is_chuiti:nth-child(1)').siblings('button').removeClass('is_chuiti_checked');
                        $.each(patient_info.types, function(index, item) {
                            $("input[name='types'][value='" + item + "']").attr('checked', true);
                            $("input[name='types'][value='" + item + "']").siblings().addClass('layui-form-checked');
                        })
                    } else if (patient_info.has_chuiti == 0) {
                        $('.has-pituitary').hide();
                        $('.no-has-pituitary').show();
                        $('.baseinfo-item .is_chuiti:nth-child(2)').addClass('is_chuiti_checked');
                        $('.baseinfo-item .is_chuiti:nth-child(2)').siblings('button').removeClass('is_chuiti_checked');
                        $.each(patient_info.types, function(index, item) {
                            $("input[name='types'][value='" + item + "']").attr('checked', true);
                            $("input[name='types'][value='" + item + "']").siblings().addClass('layui-form-checked');
                        })
                    };
                    /*$.each(patient_info.types,function(index,item){
                        $("input[name='types'][value='"+item+"']").attr('checked',true);
                        $("input[name='types'][value='"+item+"']").siblings().addClass('layui-form-checked');
                    })*/
                    $('input[name=name]').val(patient_info.name);
                    $('select[name=ethnicity]').val(patient_info.ethnicity);
                } else {
                    layer.msg(res.msg, {
                        icon: 5,
                        time: 1500
                    });
                    return false;
                }
                form.render();
            })

            //修改手机号
            $('#edit_mobile').click(function() {
                $('.fixed-container-1').show();
            })
            // 验证手机号 harvey
            $('#checkMobile').click(function() {
                $('.check_mobile_popup').show();
            })
            //关闭修改手机
            $('.fixed-main-close').click(function() {
                $('.fixed-container-1').hide();
                $('.check_mobile_popup').hide();
            })
            $('.cancel-btn').click(function() {
                $('.fixed-container-1').hide();
                $('.check_mobile_popup').hide();
            })

            $('.send-code1').click(function() {
                var mobile = $("input[name='new_mobiles']").val();
                if (mobile == '') {
                    layer.msg('请输入手机号', {
                        icon: 5,
                        time: 1500
                    });
                    return false;
                }
                var loadindex = layer.load();
                ajax_post(configUrl.changeCellSendSms, {
                    cell: mobile
                }, (res) => {
                    layer.close(loadindex);
                    if (res.status == 0) {
                        layer.msg('发送成功', {
                            icon: 1,
                            time: 1000
                        }, function() {
                            timer2 = setInterval('CountSendSms()', 1000);
                        });
                    } else {
                        layer.msg(res.msg, {
                            icon: 5,
                            time: 1500
                        });
                    }
                })
            });

            $('.send-code2').click(function() {
                var mobile = document.getElementById('yuaniphone').innerHTML;
                // if (mobile == '') {
                //     layer.msg('请输入手机号', {
                //         icon: 5,
                //         time: 1500
                //     });
                //     return false;
                // }
                var loadindex = layer.load();
                ajax_post(configUrl.changeCellSendSms, {
                    cell: mobile
                }, (res) => {
                    layer.close(loadindex);
                    if (res.status == 0) {
                        layer.msg('发送成功', {
                            icon: 1,
                            time: 1000
                        }, function() {
                            timer2 = setInterval('CountSendSms()', 1000);
                        });
                    } else {
                        layer.msg(res.msg, {
                            icon: 5,
                            time: 1500
                        });
                    }
                })
            });

            //修改手机号确定
            $('.changeCellBtn').click(function() {
                var mobile = $("input[name=new_mobiles]").val();
                var new_mobile_code = $("input[name=new_mobile_code]").val();
                if (mobile == '') {
                    layer.msg('请输入手机号', {
                        icon: 5,
                        time: 1500
                    });
                    return false;
                }
                if (new_mobile_code == '') {
                    layer.msg('请输入验证码', {
                        icon: 5,
                        time: 1500
                    });
                    return false;
                }
                var loadindex = layer.load();
                ajax_post(configUrl.patientChangeCell, {
                    mobile: mobile,
                    verify_code: new_mobile_code,
                    user_id: patient_id
                }, (res) => {
                    console.log(res);
                    layer.close(loadindex);
                    if (res.status == 0) {
                        layer.msg(res.msg, {
                            icon: 1,
                            time: 1000
                        }, function() {});
                        setTimeout(() => {
                            $('.fixed-container').hide();
                        }, 1500);
                    } else {
                        layer.msg(res.msg, {
                            icon: 5,
                            time: 1500
                        });
                    }
                })
            })
            //检查手机号确定 harvey
            // todo 需要后端给检查手机号的API
            $('.check_mobile_popup_submit').click(function() {
                // var mobile = $("input[name=new_mobiles]").val();
                var mobile = document.getElementById('yuaniphone').innerHTML;
                var new_mobile_code = $("input[name=new_mobile_code1]").val();
                if (mobile == '') {
                    layer.msg('请输入手机号', {
                        icon: 5,
                        time: 1500
                    });
                    return false;
                }
                if (new_mobile_code == '') {
                    layer.msg('请输入验证码', {
                        icon: 5,
                        time: 1500
                    });
                    return false;
                }
                var loadindex = layer.load();
                ajax_post(configUrl.patientChangeCell, {
                    mobile: mobile,
                    verify_code: new_mobile_code,
                    user_id: patient_id
                }, (res) => {
                    console.log(res);
                    layer.close(loadindex);
                    if (res.status == 0) {
                        layer.msg(res.msg, {
                            icon: 1,
                            time: 1000
                        }, function() {});
                        $('.go-yz-tip-panel').hide()
                        $('.edit_mobile_panel').show()
                        setTimeout(() => {
                            $('.fixed-container').hide();
                            $('.check_mobile_popup').hide();
                        }, 1500);
                    } else {
                        layer.msg(res.msg, {
                            icon: 5,
                            time: 1500
                        });
                    }
                })
            })

            $('.is_chuiti').click(function() {
                if ($(this).hasClass('is_chuiti_checked')) {
                    $(this).removeClass('is_chuiti_checked');
                    $(this).siblings('input').val('');
                    $('.has-pituitary').hide();
                    $('.no-has-pituitary').hide();
                    $('.has-pituitary input[name=types]').each(function() {
                        $(this).attr('checked', false);
                    })
                    $('.no-has-pituitary input[name=types]').each(function() {
                        $(this).attr('checked', false);
                    })
                } else {
                    $(this).addClass('is_chuiti_checked');
                    $(this).siblings().removeClass('is_chuiti_checked');
                    var value = $(this).attr('data-val');
                    $('input[name=has_chuiti]').val(value);
                    if (value == 1) {
                        $('.has-pituitary').show();
                        $('.no-has-pituitary').hide();
                        //把no-has-pituitary下的checkbox清空
                        $('.no-has-pituitary input[name=types]').each(function() {
                            $(this).prop('checked', false);
                        })
                    } else {
                        $('.has-pituitary').hide();
                        $('.no-has-pituitary').show();
                        //把has-pituitary下的checkbox清空
                        $('.has-pituitary input[name=types]').each(function() {
                            $(this).prop('checked', false);
                        })
                    }
                    form.render();
                }
            });

            $('.sex-btn').click(function() {
                if ($(this).hasClass('sex-btn-checked')) {
                    $(this).removeClass('sex-btn-checked')
                    $(this).siblings('input').val('');
                } else {
                    $(this).addClass('sex-btn-checked');
                    $(this).siblings().removeClass('sex-btn-checked');
                    var value = $(this).attr('data-val');
                    $(this).siblings('input').val(value);
                }
            });

            //v1.1
            $('.family_like_has').click(function() {
                var value = $(this).attr('data-val');
                console.log(value)
                if ($(this).hasClass('family_like_has_checked')) {
                    $(this).removeClass('family_like_has_checked');
                    $(this).siblings('input').val('');
                    $('.family_like_has_type_name').hide();
                    $('.zhongliu-item').hide();
                } else {
                    $(this).addClass('family_like_has_checked');
                    $(this).siblings().removeClass('family_like_has_checked');
                    var value = $(this).attr('data-val');
                    $('input[name=family_like_has]').val(value);
                    if (value == 1) {
                        $('.family_like_has_type_name').show();
                        $('.zhongliu-item').show();
                    } else {
                        $('.family_like_has_type_name').hide();
                        $('.zhongliu-item').hide();
                        $('input[name=family_like_has_type_name]').val('');
                        $('#family_like_has_chuiti_relationship').val('');
                        $('input[name=family_like_has_zhongliu]').val(0);
                        $('input[name=family_like_has_zhongliu_name]').val('');
                        $('#family_like_has_zhongliu_relationship').val('');
                    }
                    form.render();
                }
            });

            $('.family_like_has_zhongliu').click(function() {
                var value = $(this).attr('data-val');
                console.log(value)
                if ($(this).hasClass('family_like_has_zhongliu_checked')) {
                    $(this).removeClass('family_like_has_zhongliu_checked');
                    $(this).siblings('input').val('');
                    $('.family_like_has_zhongliuname').hide();
                } else {
                    $(this).addClass('family_like_has_zhongliu_checked');
                    $(this).siblings().removeClass('family_like_has_zhongliu_checked');
                    var value = $(this).attr('data-val');
                    $('input[name=family_like_has_zhongliu]').val(value);
                    if (value == 1) {
                        $('.family_like_has_zhongliu_name').show();
                    } else {
                        $('.family_like_has_zhongliu_name').hide();
                        $('input[name=family_like_has_zhongliu]').val(0);
                        $('input[name=family_like_has_zhongliu_name]').val('');
                        $('#family_like_has_zhongliu_relationship').val('');
                    }
                    form.render();
                }
            });

            // $('.family_like_has').click(function () {
            //     var value = $(this).attr('data-val');
            //     console.log(value)
            //     if ($(this).hasClass('family_like_has_checked')) {
            //         $(this).removeClass('family_like_has_checked');
            //         $(this).siblings('input').val('');
            //         $('.family_like_has_type_name').hide();
            //     } else {
            //         $(this).addClass('family_like_has_checked');
            //         $(this).siblings().removeClass('family_like_has_checked');
            //         var value = $(this).attr('data-val');
            //         $('input[name=family_like_has]').val(value);
            //         if (value == 1) {
            //             $('.family_like_has_type_name').show();
            //         } else {
            //             $('.family_like_has_type_name').hide();
            //             $('input[name=family_like_has_type_name]').val('');
            //         }
            //         form.render();
            //     }
            // });

            // v1.1 信息校验
            form.verify({
                cell: function(value) {
                    // if($('input[name=cell]').val() == '' && $('input[name=pic_id]').val() == ''){
                    //     return '手机号和病历本首页照片请至少上传一项';
                    // }
                    if ($('input[name=cell]').val() == '') {
                        return '请输入手机号';
                    }
                    if (!new RegExp("(^$)|^1\\d{10}$").test(value)) {
                        return '手机号必须11位数字';
                    }
                },
                code: function(value) {
                    if (!new RegExp("(^$)|^\\d{4}").test(value)) {
                        return '验证码必须4位数字';
                    }
                },
                name: function(value) {
                    if (value.length == 0) {
                        return '请填写患者姓名';
                    }
                    if (value.length > 10) {
                        return '姓名不能超过10个字';
                    }
                },
                gender: function(value) {
                    if ($('input[name=sex]').val() == '') {
                        return '请选择性别';
                    }
                },
                birthday: function(value) {
                    if (value.length == 0) {
                        return '请选择出生日期';
                    }
                },
                nation: function(value) {
                    if (value.length == 0) {
                        return '请选择民族';
                    }
                },
                id_number: function(value) {
                    if (value.length == 0) {
                        return '请填写身份证号';
                    }
                    if (!new RegExp("(^$)|^[1-9]\\d{16}([0-9Xx])").test(value)) {
                        return '请填写正确的身份证号';
                    }
                },
                native: function(value) {
                    if (value.length == 0) {
                        return '请选择籍贯';
                    }
                },
                disease: function(value) {
                    if (value.length > 20) {
                        return '诊断名称不能超过20个字';
                    }
                },
                id_height: function(value) {
                    if (value.length == 0) {
                        return '请填写身高';
                    }
                },
                id_weight: function(value) {
                    if (value.length == 0) {
                        return '请填写体重';
                    }
                },
                id_physian: function(value) {
                    if (value.length == 0) {
                        return '请填写体质指数';
                    }
                },
                id_yaowei: function(value) {
                    if (value.length == 0) {
                        return '请填写腰围';
                    }
                },
                id_tun: function(value) {
                    if (value.length == 0) {
                        return '请填写臀围';
                    }
                }
            });

            form.on('submit(submit-btn)', function(data) {
                var params = data.field;
                var types = [];
                $('input[name=types]').each(function() {
                    var checked = $(this).prop('checked');
                    if (checked == true) {
                        types.push($(this).val());
                    }
                });

                //params.types = JSON.stringify(types);
                params.user_id = getLocalStorage('patient_id');
                console.log(params);
                var loadindex = layer.load();
                ajax_post(configUrl.patientSave, params, (res) => {
                    console.log(res);
                    layer.close(loadindex);
                    if (res.status == 0) {
                        ajax_post(configUrl.patientPituitary, {
                            has: params.has_chuiti,
                            types: types.join(','),
                            user_id: params.user_id
                        }, (res) => {
                            if (res.status == 0) {
                                layer.msg('提交成功', {
                                    icon: 1,
                                    time: 1000
                                }, function() {
                                    //window.location.reload();
                                    window.location.href = '../qss/qss1.html';
                                });
                            } else {
                                layer.msg(res.msg, {
                                    icon: 5,
                                    time: 1500
                                });
                            }
                        })
                    } else {
                        layer.msg(res.msg, {
                            icon: 5,
                            time: 1500
                        });
                    }
                })
            });

            getRegion(form);

            function getRegion(form) {
                //获取地市
                ajax_get(configUrl.getRegion, '', (res) => {
                    $('.birthplace').empty();
                    var str = '<option value="">请选择</option>';
                    $('.birthplace').append(str);
                    $.each(res.data, function(index, item) {
                        var str2 = '<option value="' + item.id + '">' + item.name + '</option>';

                        if (patient_info.ancestral_home > 0) {
                            if (patient_info.ancestral_home == item.id) {
                                str2 = '<option value="' + item.id + '" selected>' + item.name + '</option>';
                            }
                        }
                        if(index != 'occupationInfo'){
                            $('.birthplace').append(str2);
                        }
                    });
                    form.render();
                })
            }

        })
    })
</script>

</html>
